home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10377 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  978 b 

  1. Path: airdmhor.gen.nz!not-for-mail
  2. From: gumboot@airdmhor.gen.nz (Simon Hosie)
  3. Newsgroups: comp.lang.c
  4. Subject: Non arithmetic integer type.
  5. Date: 17 Mar 1996 22:20:17 +1200
  6. Organization: Airdmhor : a couple of BBS's, a bunch of people, and a cat.
  7. Message-ID: <4igp11$83a@airdmhor.gen.nz>
  8. NNTP-Posting-Host: airdmhor.gen.nz
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11.   I've been trying to create a data type that holds an int or intlike chunk
  12. of data that is incompatible with any other types (to generate errors if
  13. someone assumes that it's the same type as an int).. I've found that
  14.  
  15. typedef struct { int Value; } TypeA;
  16. typedef struct { int ValueWithADifferentName; } TypeB;
  17.  
  18.   makes two compatible types; a variable of TypeA can be assigned to a
  19. variable of TypeB without any warnings.. but
  20.  
  21. typedef struct { int Value; } TypeA;
  22. typedef struct { unsigned Value; } TypeB;
  23.  
  24.   is incompatible, which is what I want and it works.. but what if I want
  25. three or more incompatible types?
  26.